import { NgModule } from '@angular/core';
import { RouterModule, NavigationEnd, Router } from '@angular/router';
//市采物资			  
import { MarkAccountComponent } from './market/account/mark-account.component';
import { MarkBaseInfoComponent } from './market/base/mark-base-info.component';
import { MarketIntoComponent } from './market/into/market-into.component';
import { MarketInventoryComponent } from './market/inventory/market-inventory.component';
import { MarketOutComponent } from './market/out/market-out.component';
import { MarketCancelComponent } from './market/cancel/market-cancel.component';
import { MarketReturnComponent } from './market/return/market-return.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    // 市采
                    { path: 'mark-baseinfo', component: MarkBaseInfoComponent },
                    { path: 'mark-account', component: MarkAccountComponent },
                    { path: 'market-into', component: MarketIntoComponent },
                    { path: 'market-inventory', component: MarketInventoryComponent },
                    { path: 'market-out', component: MarketOutComponent },
                    { path: 'market-cancel', component: MarketCancelComponent },
                    { path: 'market-return', component: MarketReturnComponent }
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class StockMarketRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
